package com.jincp.image.load.glide_loder;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.rastermill.FrameSequenceDrawable;
import android.text.TextUtils;
import android.util.Log;

import com.bumptech.glide.Glide;
import com.bumptech.glide.Registry;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;
import com.jincp.image.load.gif.FrameSequenceDecoder;

import java.io.InputStream;

/**
 * Created by Administrator on 2018\11\18 0018.
 */

@GlideModule
public class GlideProxyModule extends AppGlideModule {

    @Override
    public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
        super.registerComponents(context, glide, registry);
        String CPU_ABI = android.os.Build.CPU_ABI;
        if (CPU_ABI.startsWith("armeabi")) { // 加载FrameSequence的.so库
            registry.append(Registry.BUCKET_GIF, InputStream.class, FrameSequenceDrawable.class, new FrameSequenceDecoder(glide.getBitmapPool()));
        }
    }

    @Override
    public boolean isManifestParsingEnabled() {
        return false;
    }
}
